Skip to content

Update globals for usage with plugin v2#34

Merged
lopert merged 3 commits into
mainfrom
lopert.use-javy-v2
Apr 30, 2025
Merged

Update globals for usage with plugin v2#34
lopert merged 3 commits into
mainfrom
lopert.use-javy-v2

Conversation

@lopert
Copy link
Copy Markdown
Contributor

@lopert lopert commented Apr 25, 2025

Part of https://github.com/shop/issues-shopifyvm/issues/29

  • Will require coordinating with a CLI update
  • Requires a version bump. Probably major at least minor to avoid having older/existing CLI client/extensions pulling this in (the dep is ~tilde) and attempting to use it with plugin v1

Updates the globals to use ShopifyFunction instead of Javy.JSON.

Copy link
Copy Markdown
Contributor

@saga-dasgupta saga-dasgupta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me.

Comment thread run.ts Outdated
@@ -1,23 +1,28 @@
export type ShopifyFunction<Input extends {}, Output extends {}> = (
export type userFunction<Input extends {}, Output extends {}> = (
Copy link
Copy Markdown
Contributor

@saulecabrera saulecabrera Apr 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason why the name of this type was updated?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think since it was ShopifyFunction, it was colliding with the same-named interface or global.

interface ShopifyFunction {
readInput(): any;
writeOutput(val: any);
}
declare global {
const ShopifyFunction: ShopifyFunction;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I was mostly asking because types are usually capitalized, UserFunction. Mind capitalizing this type?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do!

@lopert lopert force-pushed the lopert.use-javy-v2 branch from b9c503a to 1f06878 Compare April 30, 2025 15:07
@lopert lopert changed the title [DNM] Update globals for usage with plugin v2 Update globals for usage with plugin v2 Apr 30, 2025
@lopert
Copy link
Copy Markdown
Contributor Author

lopert commented Apr 30, 2025

Keeping the version bump as a major one since that affects our build-time check over in the CLI.

Keeping it as major will allow us to use that check to make sure things stay aligned.

@lopert lopert merged commit 62a55c5 into main Apr 30, 2025
1 check passed
@saga-dasgupta
Copy link
Copy Markdown
Contributor

/snapit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants